<!DOCTYPE html>
<!--conf
<sample>
              <product version="4.0b1" edition="std"/>
                     <modifications>
                            <modified date="140109"/>
                     </modifications>
               </sample>
-->
<html>
<head>
	<title>onPopupShow / onPopupHide events</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
	<style>
		#calendarHere {
			position: relative;
			height: 250px;
		}
		#logsHere {
			width: 500px;
			height: 150px;
			overflow: auto;
			border: 1px solid #cecece;
			font-family: Tahoma;
			font-size: 12px;
		}
	</style>
	<script>
		var myCalendar;
		var logObj;
		var logInd = 0;
		var logData = [];
		
		function doOnLoad() {
			
			myCalendar = new dhtmlXCalendarObject("calendarHere");
			myCalendar.hideTime();
			myCalendar.show();
			myCalendar.setDate("2013-03-01");
			myCalendar.setHolidays("2013-03-08");
			myCalendar.setHolidays("2013-03-19,2013-03-20,2013-03-21,2013-03-22");
			
			myCalendar.setTooltip("2013-03-08", "International Women's Day", true, true);
			myCalendar.setTooltip("2013-03-19,2013-03-20,2013-03-21,2013-03-22", "Going fishing to Vindafjord :)<br>Tremble trout!", true, true);
			myCalendar.setTooltip("2013-03-10", "Just a usual date, "+myCalendar.getFormatedDate("%l, %F %d", new Date(2013,2,10)), true, true);
			
			myCalendar.attachEvent("onPopupShow", function(d){
				logData.push((++logInd)+") onPopupShow event, date "+myCalendar.getFormatedDate("%d.%m.%Y",d));
				writeLog();
			});
			myCalendar.attachEvent("onPopupHide", function(d){
				logData.push((++logInd)+") onPopupHide event, date "+myCalendar.getFormatedDate("%d.%m.%Y",d));
				writeLog();
			});
		}
		
		
		function writeLog() {
			if (!logObj) logObj = document.getElementById("logsHere");
			var t = "";
			for (var q=logData.length-1; q>=Math.max(logData.length-6,0); q--) t += logData[q]+"<br>";
			logObj.innerHTML = t;
		}
		
	</script>
</head>
<body onload="doOnLoad();">
	<div style="margin-bottom: 20px;">Tooltips set for March 8, 10, 19-22</div>
	<div id="calendarHere"></div>
	<div id="logsHere"></div>
</body>
</html>
